package servlets.reserva;

import java.io.IOException;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import br.Mesa;
import facade.RestauranteFacade;

/**
 * Servlet implementation class CadastrarCategoriaServlet
 */
@WebServlet("/cadastrarReserva")
public class CadastrarReservaServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		Date dataInicio = null;
		Date dataFim = null;
		
		Mesa mesa = new Mesa();
		mesa.setNumero(numero);
		mesa.setQuantidade(quantidade);
		mesa.setDescricao(descricao);
		mesa.setReserva(reserva);
		
		
		
		
		if(!id.equals("")){
			mesa.setId(new Long(id));
			RestauranteFacade.atualizarMesa(mesa);
		}else{
			RestauranteFacade.inserirMesa(mesa);
		}
		
		response.sendRedirect("novaMesa");
	}

}
